'use strict';

/* eslint-disable fecs-no-require */
const loaderUtils = require('loader-utils');
/* eslint-enable */

module.exports = function (content) {
    const query = loaderUtils.parseQuery(this.query);

    if (this.cacheable) {
        this.cacheable();
    }

    Object.keys(query).forEach(key => {
        content = content.replace(new RegExp(key, 'g'), query[key]);
    });

    return 'module.exports = ' + JSON.stringify(content);
};
